package com.spring.dive;

import com.spring.dive.model.UserModel;
import com.spring.dive.servlet.CsvOutputGenerator;
import com.spring.dive.servlet.IOutputGenerator;
import com.spring.dive.servlet.OutputHelper;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestMain {

    public static void main(String[] args) {
        // spring对象
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserModel helloModel = context.getBean("helloModel", UserModel.class);
        System.out.println("--------IOC对象："+helloModel);

        // 对象创建
        IOutputGenerator output = new CsvOutputGenerator();
        output.generateOutput();

        // 工具类使用
        OutputHelper output1 = new OutputHelper();
        output1.generateOutput();

        // IOC对象
        OutputHelper output2 = context.getBean("OutputHelper",OutputHelper.class);
        output2.generateOutput();

    }
}
